---
description: "Reference for Nitric's Python library - List keys in a key value store."
---

# Python - kv.keys()

<Note>
  This is reference documentation for the Nitric Python SDK. To learn about
  Key/Value Stores in Nitric start with the [Key/Value Store docs](/keyvalue).
</Note>

Get a value from a key value store.

```python
from nitric.resources import kv
from nitric.application import Nitric

profiles = kv('profiles').allow('get')

for await key in profiles.keys():
    # Do something with the key

Nitric.run()
```

## Parameters

<Properties>
  <Property name="key" required type="string">
    The key that references the key value pair that should be retrieved.
  </Property>
</Properties>

## Examples

### Get a key value pair

```python
from nitric.resources import kv
from nitric.application import Nitric

profiles = kv('profiles').allow('get')

for await key in profiles.keys():
    # Do something with the key

Nitric.run()
```

### Filter by a prefix

```python
from nitric.resources import kv
from nitric.application import Nitric

profiles = kv('profiles').allow('get')

# search for keys beginning with "profile:"
for await key in profiles.keys("profile:"):
    # Do something with the key

Nitric.run()
```
